package com.ruoyi.system.service.impl;

import java.util.List;
import com.ruoyi.common.utils.DateUtils;
import com.ruoyi.common.utils.ip.IpUtils;
import com.ruoyi.system.domain.vo.StaticVo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.system.mapper.ViewLogMapper;
import com.ruoyi.system.domain.ViewLog;
import com.ruoyi.system.service.IViewLogService;

/**
 * viewLogService业务层处理
 * 
 * @author ruoyi
 * @date 2025-05-30
 */
@Service
public class ViewLogServiceImpl implements IViewLogService 
{
    @Autowired
    private ViewLogMapper viewLogMapper;

    /**
     * 查询viewLog
     * 
     * @param id viewLog主键
     * @return viewLog
     */
    @Override
    public ViewLog selectViewLogById(Long id)
    {
        return viewLogMapper.selectViewLogById(id);
    }

    /**
     * 查询viewLog列表
     * 
     * @param viewLog viewLog
     * @return viewLog
     */
    @Override
    public List<ViewLog> selectViewLogList(ViewLog viewLog)
    {
        return viewLogMapper.selectViewLogList(viewLog);
    }

    /**
     * 新增viewLog
     * 
     * @param viewLog viewLog
     * @return 结果
     */
    @Override
    public int insertViewLog(ViewLog viewLog)
    {
        viewLog.setCreateTime(DateUtils.getNowDate());
        viewLog.setIp(IpUtils.getIpAddr());
        return viewLogMapper.insertViewLog(viewLog);
    }

    /**
     * 修改viewLog
     * 
     * @param viewLog viewLog
     * @return 结果
     */
    @Override
    public int updateViewLog(ViewLog viewLog)
    {
        return viewLogMapper.updateViewLog(viewLog);
    }

    /**
     * 批量删除viewLog
     * 
     * @param ids 需要删除的viewLog主键
     * @return 结果
     */
    @Override
    public int deleteViewLogByIds(Long[] ids)
    {
        return viewLogMapper.deleteViewLogByIds(ids);
    }

    /**
     * 删除viewLog信息
     * 
     * @param id viewLog主键
     * @return 结果
     */
    @Override
    public int deleteViewLogById(Long id)
    {
        return viewLogMapper.deleteViewLogById(id);
    }

    @Override
    public List<StaticVo> viewTotal(String beginTime, String endTime) {
        return viewLogMapper.viewTotal(beginTime,endTime);
    }

    @Override
    public List<StaticVo> viewTotalNum(String beginTime, String endTime) {
        return viewLogMapper.viewTotalNum(beginTime,endTime);
    }
}
